{% extends "base.html" %}

{% block title %}开班列表{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>开班列表</h2>
    <a href="{{ url_for('add_class') }}" class="btn btn-primary">添加开班</a>
</div>

<div class="table-responsive">
    <table class="table table-striped">
        <thead>
            <tr>
                <th>编号</th>
                <th>年级</th>
                <th>年度</th>
                <th>学期</th>
                <th>操作</th>
            </tr>
        </thead>
        <tbody>
            {% for class_obj in classes %}
            <tr>
                <td>{{ class_obj.id }}</td>
                <td>{{ class_obj.grade }}</td>
                <td>{{ class_obj.year }}</td>
                <td>{{ class_obj.semester }}</td>
                <td>
                    <a href="{{ url_for('view_class', id=class_obj.id) }}" class="btn btn-sm btn-info">查看</a>
                    <a href="{{ url_for('edit_class', id=class_obj.id) }}" class="btn btn-sm btn-warning">编辑</a>
                    <form action="{{ url_for('delete_class', id=class_obj.id) }}" method="POST" class="d-inline">
                        <button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('确定要删除这个班级吗？')">删除</button>
                    </form>
                </td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
</div>
{% endblock %} 